﻿using System.Collections.Generic;

namespace Utility
{
    /// <summary>
    /// ResponseData DTO
    /// </summary>
    public class ResponseDataDTO
    {
        public ResponseDataDTO(bool success = false, string msg = "")
        {
            if (success)
            {
                status = ResultCode.Success;
                message = msg == "" ? "成功" : msg;
            }
        }

        public object data { get; set; }
        public ResultCode status { get; set; }
        public string message { get; set; }
    }

    public class ResponseDataDTO<T>
    {
        public ResponseDataDTO(bool success = false, string msg = "")
        {
            if (success)
            {
                status = ResultCode.Success;
                message = msg == "" ? "成功" : msg;
            }
        }
        public T data { get; set; }
        public ResultCode status { get; set; }
        public string message { get; set; }
    }


    #region 分页DTO

    /// <summary>
    /// 分页DTO
    /// </summary>
    /// <typeparam name="T">泛型实体</typeparam>
    public class PageDataDTO<T>
    {
        /// <summary>
        /// 总数
        /// </summary>
        public int total { get; set; }
        /// <summary>
        ///  数据集
        /// </summary>
        public List<T> list { get; set; }

        /// <summary>
        /// 实例化List
        /// </summary>
        public PageDataDTO()
        {
            total = 0;
            list = new List<T>();
        }
    }

    /// <summary>
    /// 分页输出DTO
    /// </summary>
    /// <typeparam name="T"></typeparam>
    //public class PageDataDTO
    //{
    //    /// <summary>
    //    /// 总数
    //    /// </summary>
    //    public int total { get; set; } = 0;
    //    /// <summary>
    //    /// 数据集
    //    /// </summary>
    //    public object list { get; set; }
    //}

    /// <summary>
    /// 分页DTO
    /// </summary>
    public class ResponsePageDTO
    {
        /// <summary>
        /// 总数
        /// </summary>
        public int total { get; set; } = 0;
        /// <summary>
        /// 数据集
        /// </summary>
        public object list { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public ResultCode status { get; set; }
        /// <summary>
        /// 消息
        /// </summary>
        public string message { get; set; }
    }

    #endregion


}
